#include<fstream>
#include<cstdlib>
#include<string>

void appendSlashToFile(const std::string &filename) {
    std::ofstream file(filename, std::ios::app); // ios::app 表示追加
    if (!file) {
        perror("Failed to open file");
        return;
    }
    file << "/" << std::endl; // 往文件末尾加 '/'
    file.close();
}

void gitAddCommitPush(const std::string &filename) {
    std::string cmd;

    // git add
    cmd = "git add " + filename;
    system(cmd.c_str());

    // git commit
    cmd = "git commit -m \"add / to file\"";
    system(cmd.c_str());

    // git push
    cmd = "git push";
    system(cmd.c_str());
}
int main()
{
    appendSlashToFile("./text.txt");
    gitAddCommitPush("./text.txt");
    return 0;
}